<nz-spin *ngIf="isLoading" class="modal-spin"></nz-spin>
<form nz-form *ngIf="!isLoading" [formGroup]="validateForm" (ngSubmit)="submitForm()">
  <nz-form-item>
    <nz-form-label [nzSpan]="5" nzRequired nzFor="title">名称</nz-form-label>
    <nz-form-control [nzSpan]="15" [nzValidateStatus]="validateForm.controls['title']">
      <input type="text" nz-input formControlName="title" placeholder="名称">
      <nz-form-explain *ngIf="validateForm.get('title').dirty && validateForm.get('title').hasError('required')">请输入名称</nz-form-explain>
      <nz-form-explain *ngIf="validateForm.get('title').dirty && validateForm.get('title').hasError('maxlength')">不能超过30个字</nz-form-explain>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="5" nzRequired nzFor="sortNum">排序号</nz-form-label>
    <nz-form-control [nzSpan]="15">
      <nz-input-number style="width: 100%;" [nzMin]="1" [nzMax]="10000" [nzStep]="1" [nzPlaceHolder]="'排序号'" formControlName="sortNum"></nz-input-number>
      <nz-form-explain *ngIf="validateForm.get('sortNum').dirty && validateForm.get('sortNum').hasError('required')">请输入排序号</nz-form-explain>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item *ngIf="!isModel">
    <nz-form-label [nzSpan]="5"  nzFor="sortNum">当前剩余积分</nz-form-label>
    <nz-form-control [nzSpan]="15">
      <nz-form-extra style="color: orange;padding-top: 10px;">
       {{entity.credit}}
      </nz-form-extra>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="5" nzFor="customerId">负责人</nz-form-label>
    <nz-form-control [nzSpan]="15" [nzValidateStatus]="validateForm.controls['customerId']">
      <nz-select formControlName="customerId" [nzPlaceHolder]="'负责人(输入要设置的负责人进行搜索)'"  [nzDisabled]="entity.customerId" [nzServerSearch]="true" [nzShowSearch]="true" (nzOnSearch)="onSearch($event)" [nzAllowClear]="true">
        <ng-container *ngFor="let option of customerList">
          <nz-option *ngIf="!loadingOption" [nzValue]="option.id" [nzLabel]="option.name"></nz-option>
        </ng-container>
        <nz-option *ngIf="loadingOption" nzDisabled nzCustomContent>
          <i nz-icon type="loading" class="loading-icon"></i> 搜索中
        </nz-option>
      </nz-select>
      <nz-form-extra style="color: orange;">
        温馨提示：<br/>
        为用户设置负责管理的运营中心，即同时将用户设为运营中心角色；<br/>
        运营中心负责人设置后不可修改
      </nz-form-extra>
      <nz-form-explain *ngIf="validateForm.get('customerId').dirty && validateForm.get('customerId').hasError('required')">请选择负责人</nz-form-explain>
    </nz-form-control>
  </nz-form-item>
  <div class="modal-footer" [ngStyle]="{ 'text-align': isModel?'right':'center','margin': isModel?'':'0'}" >
    <button nz-button *ngIf="isModel" type="button" (click)="close()">关闭</button>
    <button nz-button type="submit" [nzType]="'primary'" >保存</button>
  </div>
</form>
